<!-- <style tyle="text/css">
	.modal-lg {
	width: 90%;
	}
</style> -->
<div class="container-fluid form-horizontal">
	<div class="col-xs-12">
		<style type="text/css">
			.col-lg-1,
			.col-lg-10,
			.col-lg-11,
			.col-lg-12,
			.col-lg-2,
			.col-lg-3,
			.col-lg-4,
			.col-lg-5,
			.col-lg-6,
			.col-lg-7,
			.col-lg-8,
			.col-lg-9,
			.col-md-1,
			.col-md-10,
			.col-md-11,
			.col-md-12,
			.col-md-2,
			.col-md-3,
			.col-md-4,
			.col-md-5,
			.col-md-6,
			.col-md-7,
			.col-md-8,
			.col-md-9,
			.col-sm-1,
			.col-sm-10,
			.col-sm-11,
			.col-sm-12,
			.col-sm-2,
			.col-sm-3,
			.col-sm-4,
			.col-sm-5,
			.col-sm-6,
			.col-sm-7,
			.col-sm-8,
			.col-sm-9,
			.col-xs-1,
			.col-xs-10,
			.col-xs-11,
			.col-xs-12,
			.col-xs-2,
			.col-xs-3,
			.col-xs-4,
			.col-xs-5,
			.col-xs-6,
			.col-xs-7,
			.col-xs-8,
			.col-xs-9 {
				position: inherit !important;
				;
			}
		</style>

		<div class="form-group mt10">
			<label class="col-xs-1 control-label">添加票种</label>
			<div class="col-xs-3">
				<ui-select ng-model="tickettypeobj.place_code" theme="bootstrap" ng-change="changeview()">
					<ui-select-match placeholder="请选择一个景区">{{$select.selected.name}}</ui-select-match>
					<ui-select-choices repeat="item.code as item in page.viewlist | filter: $select.search">
						<span ng-bind-html="item.name | highlight: $select.search"></span>
					</ui-select-choices>
				</ui-select>
			</div>
			<label class="col-xs-1 control-label">票种</label>
			<div class="col-xs-3">
				<ui-select ng-model="tickettypeobj.ticket_type_code" theme="bootstrap">
					<ui-select-match placeholder="请选择一个票种">{{$select.selected.name}}</ui-select-match>
					<ui-select-choices repeat="item.code as item in page.tickettypelist | filter: $select.search">
						<span ng-bind-html="item.name | highlight: $select.search"></span>
					</ui-select-choices>
				</ui-select>
			</div>
			<label class="col-xs-1 control-label">属性</label>
			<div class="col-xs-2">
				<ui-select ng-model="tickettypeobj.ticket_type_attr" theme="bootstrap">
					<ui-select-match placeholder="请选择一个票种">
						{{$select.selected.type_attr_name}}
					</ui-select-match>
					<ui-select-choices repeat="item.ticket_attr_id as item in page.attrlist | filter: $select.search">
						<span ng-bind-html="item.type_attr_name | highlight: $select.search"></span>
					</ui-select-choices>
				</ui-select>
			</div>
			<div class="col-xs-1">
				<a ng-click="add()" class="btn btn-success btn-sm">添加</a>
			</div>
		</div>

		<table class="table table-bordered mt10" style="display: table; width: 100%;table-layout:fixed;">
			<thead>
				<tr>
					<th class=" text-center" style="width:12%">景区名称<br>(票种名称)</th>
					<th class=" text-center" style="width:8%">票种属性</th>
					<th class=" text-center" style="width:10%">票种价格(元)</th>
					<th class=" text-center" style="width:10%">可销次数</th>
					<th class=" text-center" style="width:10%">购买后有效天数(天)</th>
					<th class=" text-center" style="width:15%">有效期开始/结束</th>
					<th class=" text-center" style="width:15%">有效期范围</th>
					<th class=" text-center" style="width:12%">是否需要预约</th>
					<th class=" text-center" ng-if="saleobj.state == '0' || saleobj.state == '2'" style="width:8%">操作</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="obj in page.saletickettypelist">
					<td class="text-center">{{obj.view_name}}
						<br>{{obj.name}}
					</td>
					<td class="text-center">{{obj.ticket_type_attr_name}}</td>
					<td class="text-center">
						<input type="text" name="fxbt" class="form-control form-inline" placeholder="分" ng-model="obj.price" />
					</td>
					<td class="text-center">
						<div>
							<input type="number" name="fxbt" class="form-control form-inline" min="1" ng-model="obj.sheets_number" style="width:100%"
							 ng-disabled="obj.ticket_type_attr == '10'" onkeyup="value=(parseInt((value=value.replace(/\D/g,''))=='0'||parseInt((value=value.replace(/\D/g,''))==-1)?'1':value,10))"
							 onafterpaste="value=(parseInt((value=value.replace(/\D/g,''))==''||parseInt((value=value.replace(/\D/g,''))==0)?'1':value,10))"
							/>
						</div>
					</td>
					<td class="text-center">
						<ui-select ng-model="obj.buy_effective_day" theme="bootstrap" ng-change="changeview()" style="width:100%">
							<ui-select-match placeholder="">{{$select.selected.label}}</ui-select-match>
							<ui-select-choices repeat="buy_effective_day.value as buy_effective_day in buy_effective_dayarr | filter: $select.search">
								<span ng-bind-html="buy_effective_day.label | highlight: $select.search"></span>
							</ui-select-choices>
						</ui-select>
					</td>
					<td class="text-center">
						<input type="text" 
							class="form-control" 
							ng-model="obj.periodstart" 
							ng-click="dateSet(obj.periodstart, $index, 'periodstart')" 
							readonly>
						<br />
						<input type="text" 
							class="form-control" 
							ng-model="obj.periodend" 
							ng-click="dateSet(obj.periodend, $index, 'periodend')" 
							readonly>
						<!-- {{obj.date.lable}}
						<br />{{obj.date1.lable}} -->
						<!-- <div class="input-group">
							<div class="pull-left input-group">
								<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="obj.date.lable" is-open="obj.date.opened"
								 readonly close-text="关闭" current-text="今天" clear-text="清除" />
								<span class="input-group-btn">
									<button type="button" class="btn btn-default"
											ng-click="dateOpen($event, obj.date)">
										<i class="glyphicon glyphicon-calendar"></i>
									</button>
								</span>
							</div>
						</div>
						<div class="input-group">
							<div class="pull-left input-group">
								<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-model="obj.date1.lable" is-open="obj.date1.opened"
								 readonly close-text="关闭" current-text="今天" clear-text="清除" />
								<span class="input-group-btn">
									<button type="button" class="btn btn-default"
											ng-click="dateOpen1($event, obj.date1)">
										<i class="glyphicon glyphicon-calendar"></i>
									</button>
								</span>
							</div>
						</div> -->
					</td>
					<td class="text-center">
						<textarea type="text" name="fxbt" class="form-control form-inline" ng-disabled="true" 
						ng-model="obj.period_scope" style="width: 100%; word-wrap:break-word"/>
						<a ng-click="addTime(obj)" class="btn btn-success btn-xs">设&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;置</a>
					</td>
					<td class="text-center">
						<select class="form-control" ng-model="obj.appoint" ng-disabled="obj.ticket_type_attr == '10'">
							<option value="0">无需预约</option>
							<option value="1">需要预约</option>		           
						</select>
					</td>
					<td class="text-center" ng-if="saleobj.state == '0' || saleobj.state == '2'">
						<a ng-click="save2(obj)" 
							class="btn btn-success btn-xs" 
							ng-if="(saleobj.state == '0' || saleobj.state == '2') && obj.is_available == '1'">
							恢&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;复</a>
						<a ng-click="save(obj)" 
							class="btn btn-warning btn-xs" 
							ng-if="(saleobj.state == '0' || saleobj.state == '2') && obj.is_available == '0'">
							保&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;存</a><br>
						<a ng-click="del1(obj.id)" 
							class="btn btn-danger btn-xs" 
							ng-if="(saleobj.state == '0' || saleobj.state == '2') && obj.is_available == '0'">
							删&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;除</a>
						<a ng-click="moveUp($index)" 
							class="btn btn-info btn-xs" 
							ng-if="$index != 0">
							上移
							<span class="glyphicon glyphicon-arrow-up"></span>
						</a>
						<a ng-click="moveDown($index)" 
							class="btn btn-primary btn-xs" 
							ng-if="$index != page.saletickettypelist.length - 1">
							下移
							<span class="glyphicon glyphicon-arrow-down"></span>
						</a>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>